<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>搜索</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<link rel="stylesheet" href="css/mui.min.css">
		<style>
			html,
			body {
				background-color: #efeff4;
			}
.mui-content .mui-fullscreen {
				top: 44px;
				height: auto;
			}
			.mui-pull-top-tips {
				position: absolute;
				top: -20px;
				left: 50%;
				margin-left: -25px;
				width: 40px;
				height: 40px;
				border-radius: 100%;
				z-index: 1;
			}
			.mui-bar~.mui-pull-top-tips {
				top: 24px;
			}
			.mui-pull-top-wrapper {
				width: 42px;
				height: 42px;
				display: block;
				text-align: center;
				background-color: #efeff4;
				border: 1px solid #ddd;
				border-radius: 25px;
				background-clip: padding-box;
				box-shadow: 0 4px 10px #bbb;
				overflow: hidden;
			}
			.mui-pull-top-tips.mui-transitioning {
				-webkit-transition-duration: 200ms;
				transition-duration: 200ms;
			}
			.mui-pull-top-tips .mui-pull-loading {
				/*-webkit-backface-visibility: hidden;
				-webkit-transition-duration: 400ms;
				transition-duration: 400ms;*/
				
				margin: 0;
			}
			.mui-pull-top-wrapper .mui-icon,
			.mui-pull-top-wrapper .mui-spinner {
				margin-top: 7px;
			}
			.mui-pull-top-wrapper .mui-icon.mui-reverse {
				/*-webkit-transform: rotate(180deg) translateZ(0);*/
			}
			.mui-pull-bottom-tips {
				text-align: center;
				background-color: #efeff4;
				font-size: 15px;
				line-height: 40px;
				color: #777;
			}
			.mui-pull-top-canvas {
				overflow: hidden;
				background-color: #fafafa;
				border-radius: 40px;
				box-shadow: 0 4px 10px #bbb;
				width: 40px;
				height: 40px;
				margin: 0 auto;
			}
			.mui-pull-top-canvas canvas {
				width: 40px;
			}
			.mui-slider-indicator.mui-segmented-control {
				background-color: #efeff4;
			}
			.modetext{color:#FF0000;;border: thin solid #FF0000; margin-right:20px;}
			.mui-navigate-right{color:#333333}
			.rbar{
	position: absolute;
	z-index: 999;
	top: 46px;
	right: 0px;
	padding:5px;
	background-color: #fafafa;
	}
	.red{color:#FF0000}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
		<form action="s.html" onSubmit="sreachsub()" onKeyDown="if(event.keyCode==13){sreachsub2();return false;}">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<div class="mui-title"><input id="sreach" name="q" type="text" class="mui-input-clear" placeholder="美女" style="width:70%"></div>
 <a class="header-sreach mui-pull-right"><span class="mui-icon mui-icon-search sreach"></span></a>
			</form>
		</header>
		<div class="mui-content">
			<div id="slider" class="mui-slider mui-fullscreen">
				<div id="sliderSegmentedControl" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
<div class="mui-scroll" id="group">

</div>
</div>
<div class="mui-slider-group" style="padding-bottom:60px;">

</div>
</div>
</div>
<script src="config.js"></script>
<script>
type=getQueryString('type');
if(type==null){type=0;}
posttype=getQueryString('posttype');
if(posttype==null){posttype='forum_get';
typetext=['一生V8','图片','资源','视频','问答'];
}else{
typetext=['微动态','图动态','视频动态'];
}
var key=getQueryString("q")
var mode=getQueryString("mode");
var page=getQueryString("page");
var forumlid=getQueryString("forumlid");

document.getElementById('sreach').value=key;
document.title=key+'_搜索_'+typetext[type];
var group=[{name:'综合',id:0,size:3},{name:'图片',id:1,size:1},{name:'资源',id:2,size:1},{name:'视频',id:3,size:1},{name:'问答',id:4,size:1}];
function wgroup(group){
var table=document.body.querySelector('.mui-slider-group');
var table2=document.getElementById('group');
  for (i = 0;i < group.length; i++) {
var li = document.createElement('div');
var li2 = document.createElement('a');
if(group[i]['size']==3){
li.className = 'mui-slider-item mui-control-content mui-active';
li2.className = 'mui-control-item mui-active';
}else{
li.className = 'mui-slider-item mui-control-content';
li2.className = 'mui-control-item';
}
li.id='item'+i+'mobile';
li2.href='#item'+i+'mobile';
li.innerHTML = '<div id="scroll1" class="mui-scroll-wrapper"><div class="mui-scroll" id="ms'+i+'" did="'+group[i]['id']+'"><ul class="mui-table-view" id="mv'+i+'"></ul></div></div>';
li2.innerHTML = group[i]['name'];
table.appendChild(li);
table2.appendChild(li2);
}
}
wgroup(group);
</script>
<script src="js/mui.min.js"></script>
<script src="js/mui.pullToRefresh.js"></script>
<script src="js/mui.pullToRefresh.material.js"></script>
<script>
mui.init();
function sreachsub2(){
key=document.getElementById('sreach').value
mui.each(document.querySelectorAll('.mui-slider-group .mui-scroll'), function(index, pullRefreshEl) {
div=pullRefreshEl.querySelector('.mui-table-view');
while(div.hasChildNodes()){  div.removeChild(div.firstChild); } 
pullRefreshEl.style.transform="translate3d(0px, 0px, 0px)";
});
dataa = [];	
 ajaxbool=false;
setTimeout(function() {getdowndata('no',document.getElementById('ms'+slideNumber).getAttribute("did"),document.getElementById('mv'+slideNumber));}, 500);
}
function getdowndata(self,id,table){
if(ajaxbool){if(typeof(self)=="object"){self.endPullDownToRefresh();}return;}
ajaxbool=true;
mui.post('https://www.ysv8.com/open/sreach',{key:key,mode:id,forumlid:forumlid,page:page},function(data){ 
loadi=0;
loadni=0;
for (i = data.length-1;i >-1; i--) {
  	sethtml(data[i],table,id,'down')
} 
page++;
if(typeof(self)=="object"){ 
 if(loadi<10){
self.endPullDownToRefresh();  
var li = document.createElement('li');
      li.className = 'mui-table-view-cell mui-media';
      li.innerHTML = '<p style="text-align:center">全部加载完毕</p>';
      table.appendChild(li);
}else{
self.endPullDownToRefresh(); 
  }  
  }   
   mui.toast('更新了'+loadni+'条记录',{ duration:'short', type:'div' });
  ajaxbool=false
 },'json'
);
$('.mui-scroll-wrapper').scroll({
bounce: false,
indicators: true,
deceleration:deceleration
});
}
function getupdata(self,id,table){
if(ajaxbool){self.endPullUpToRefresh(false);return;}
    ajaxbool=true;
mui.post('https://www.ysv8.com/open/sreach',{key:key,mode:id,forumlid:forumlid,page:page},function(data){ 
loadi=0;
loadni=0;
  for (i = 0;i < data.length; i++) {
  sethtml(data[i],table,id,'up') 
}
page++;
 mui.toast('成功加载'+loadi+'条记录',{ duration:'short', type:'div' });
if(loadi<10){
self.endPullUpToRefresh(true);  
var li = document.createElement('li');
      li.className = 'mui-table-view-cell mui-media';
      li.innerHTML = '<p style="text-align:center">全部加载完毕</p>';
      table.appendChild(li);
}else{
self.endPullUpToRefresh(false);
  }
  ajaxbool=false
 },'json'
);
$('.mui-scroll-wrapper').scroll({
bounce: false,
indicators: true,
deceleration:deceleration
});
}
var deceleration = mui.os.ios?0.003:0.0009;
var slideNumber=0;
(function($) {
$('.mui-scroll-wrapper').scroll({
bounce: false,
indicators: true,
deceleration:deceleration
});
$.ready(function() {
$.each(document.querySelectorAll('.mui-slider-group .mui-scroll'), function(index, pullRefreshEl) {
var selfid=pullRefreshEl.getAttribute("did");
$(pullRefreshEl).pullToRefresh({
down: {
callback: function() {
var self = this;
setTimeout(function() {
getdowndata(self,selfid,self.element.querySelector('.mui-table-view'));
									}, 1000);
								}
							},
							up: {
								callback: function() {
									var self = this;
									setTimeout(function() {
										getupdata(self,selfid,self.element.querySelector('.mui-table-view'));
									}, 1000);
								}
							}
						});
/*幻灯片事件*/						
document.querySelector('.mui-slider').addEventListener('slide', function(event) {
if(slideNumber!=event.detail.slideNumber){
 ajaxbool=false;
 page=0;
getdowndata('no',document.getElementById('ms'+event.detail.slideNumber).getAttribute("did"),document.getElementById('mv'+event.detail.slideNumber));
slideNumber=event.detail.slideNumber;
}

});

/*A时间*/	
mui(".mui-slider-group").on('tap','.mui-navigate-right',function(){
   id = this.getAttribute("id");
  mui.openWindow({
    url: 't.html?id='+id, 
    id:'info'
  });
});

/*A搜索支持*/
mui(".header-sreach").on('tap','.sreach',function(){
if(key!=document.getElementById('sreach').value){
key=document.getElementById('sreach').value;
sreachsub2();
}
});	
ajaxbool=false;
page=0;
setTimeout(function() {getdowndata('no',document.getElementById('ms0').getAttribute("did"),document.getElementById('mv0'));}, 500);
});
});
})(mui);


		</script>
	</body>

</html>